package org.doofer.test

import com.documentum.fc.client.*
import com.documentum.fc.common.*

class MockAttrib {

    def name
    def type
    def isRepeating
    def value

    MockAttrib() {}

    void truncate(index) {
        if(isRepeating) {
            value = []
        } else {
            value = null
        }
    }

    def getValueCount() {
        isRepeating && value ? value.size() : 1
    }

    def getValue(index = null) {
        if(isRepeating) {
            return value[index]
        } else {
            return value
        }
    }

    def setValue(newValue, index = null) {
        if(isRepeating) {
            value[index] = newValue
        } else {
            value = newValue
        }
    }
}